package com.zfl.practice;

import java.util.concurrent.atomic.AtomicStampedReference;

public class AtomicStampedReferrenceDemo01 {
    public static void main(String[] args) {
        User zfl = new User("zfl", 20);
        AtomicStampedReference<User> ref = new AtomicStampedReference<>(zfl,1);
        System.out.println("ref.getReference() = " + ref.getReference());
        User user1 = zfl;
        ref.compareAndSet(user1,new User("lisi",21),1,3);
        System.out.println("ref.getReference() = " + ref.getReference());
        System.out.println("ref.getStamp() = " + ref.getStamp());
    }
}
    
